home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / PACKAGE6 / INSERT.DOC < prev    next >
Text File  |  1990-07-25  |  2KB  |  48 lines

  1. ------------------------------------------------------------------------------
  2. InsertIntoString
  3. ------------------------------------------------------------------------------
  4.  
  5. declaration:   procedure InsertIntoString (    StringPiece:
  6.                                                  TypeString;
  7.                                            var ResultString:
  8.                                                  TypeString;
  9.                                                StartPosition:
  10.                                                  integer);
  11.  
  12. purpose:       Returns ResultString with the StringPiece inserted
  13.                at the StartPosition and any contents to the right
  14.                (or greater than StartPosition) are shifted rightwards.
  15.  
  16. precondition:  StringPiece, ResultString, and StartPosition are defined.
  17.  
  18. postcondition: ResultString is returned with the StringPiece inserted
  19.                into the PackedArray and the any contents to the right (or
  20.                greater than StartPosition) are shifted rightwards.
  21.  
  22. special cases: none
  23.  
  24. example:       var
  25.                  ResultString,
  26.                  StringPiece:
  27.                    TypeString;
  28.                  StartPosition:
  29.                    integer;
  30.  
  31.                begin
  32.                  .
  33.                  .
  34.                  .
  35.                  write (output,'Enter a string: ');
  36.                  ReadLnString (ResultString, LastKey);
  37.                  write (output,'Enter string piece: ');
  38.                  ReadLnString (StringPiece, LastKey)
  39.                  write (output,'Enter position to be inserted at: ');
  40.                  ReadLnCardinal (StartPosition, LastKey);
  41.                  InsertIntoString (StringPiece, ResultString, StartPosition);
  42.                  .
  43.                  .
  44.                  .
  45.                  end
  46.  
  47. ------------------------------------------------------------------------------
  48.